using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using RFIDData.Data;
using RFIDData.Models;

namespace Phoenix_RFID
{
	public partial class CommuteList : Form
	{
        Dbman db = new Dbman();

        public CommuteList()
		{
			InitializeComponent();

        }
        private void CommuteList_Load(object sender, EventArgs e)
        {
            DgvCommuteList.AutoGenerateColumns = false;
            DgvCommuteList.DataSource = db.CommuteEmployeeList();
            
        }

        private void btnFind_Click(object sender, EventArgs e)
        {

            //var result = from c in context.Commutes
            //             join ee in context.Employees
            //             on c.EmNo equals ee.EmNo
            //             select new
            //             {
            //                 Name = ee.Name,
            //                 Department = ee.Department
            //             };

            CommuteEmployee ce = new CommuteEmployee
            {
                Name = txtNameF.Text,
                Department = cmbDepartF.Text,
                Rank = cmbRankF.Text
            };

            DgvCommuteList.DataSource = db.CommuteEmployeeList(ce);
        }


        
    }
}
